#include "CSVParser.h"
#include <fstream>
#include <sstream>

CSVParser::CSVParser(const std::string& filename) {
std::ifstream file(filename.c_str());
    std::string line;
    while (std::getline(file, line)) {
        std::stringstream lineStream(line);
        std::string cell;
        std::vector<std::string> parsedRow;
        while (std::getline(lineStream, cell, ',')) {
            parsedRow.push_back(cell);
        }
        data.push_back(parsedRow);
    }
}

size_t CSVParser::getDataSize() const {
    return data.size();  
}

std::vector<std::string> CSVParser::getRow(size_t rowNumber) const {
    return data.at(rowNumber);
}

std::string CSVParser::getCell(size_t rowNumber, size_t columnNumber) const {
    return data.at(rowNumber).at(columnNumber);
}


